/*
 * Digital Audio Mobile - A multi track studio for Windows Mobile
 * Copyright (C) 2008 David Olsson
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include <windows.h>

#include "DamDialog.h"
#include "InputDevice.h"
#include "OutputDevice.h"
#include "SettingsDialog.h"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) {
    InputDevice *inDev;
    OutputDevice *outDev;
    {
        SettingsDialog settingsDlg(hInstance);
        if(!settingsDlg.hasSettings()) {
            MessageBox(0, TEXT("This appears to be the first time you have run Digital Audio Mobile on this device. You must now set up the application before you can use it."), TEXT("Digital Audio Mobile"), MB_OK | MB_ICONINFORMATION);
            settingsDlg.open();
        }
        if(!settingsDlg.hasSettings()) {
            MessageBox(0, TEXT("You cannot run Digital Audio Mobile unless you set it up!"), TEXT("Settings required!"), MB_OK | MB_ICONERROR);
            return(0);
        }
        inDev = settingsDlg.instantiateCurrentInputDevice();
        outDev = settingsDlg.instantiateCurrentOutputDevice();
    }

    DamDialog dam(hInstance, inDev, outDev);
    dam.open();

    return(0);
}
